package com.dfbz.demo01_卖票案例;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo03_Thread的基本方法 {
    public static void main(String[] args) {

        TaskThread thread=new TaskThread("线程1");
        thread.start();


        TaskThread tt=new TaskThread("线程2");
        tt.start();

        for (int i = 0; i < 10000; i++) {
            System.out.println(Thread.currentThread().getName());
        }
    }
}

class TaskThread extends Thread{

    public TaskThread() {
    }

    public TaskThread(String name) {
        super(name);
    }

    @Override
    public void run() {

        for (int i = 0; i < 10000; i++) {
            System.out.println(Thread.currentThread().getName());
            /*try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }*/
        }
    }
}
